import {routerRedux} from 'dva/router';
import api from '../api';
import moment from 'moment'



export default {
  namespace : 'product',
  state : {
  },
  // subscriptions : {
  //   setup({dispatch, history}) {
  //     history.listen(({ pathname, query }) => {
  //       if( pathname === '/match/matchManager' ){
  //         dispatch({
		// 				type: 'getAllpdt',
		// 				payload:{
		// 					currentpage:1,
		// 					pagesize:25,
		// 				}
		// 			})
  //       }
  //     })
  //   }
  // },
  effects : {
    * getAllpdt({payload},{call,put}) {
      const response = yield call(api.getpdtList, payload);
      yield put({
        type: 'getAllpdtSuccess',
        payload: response ,
      });
    },
  },
  reducers : {
    clearState(state) {
      return{}
    },
    getAllpdtSuccess(state, {payload}) {
      const {data,page} = payload
      return {
        ...state,
        pdtList:data,
        pdtPage:page
      }
    },
  }
};
